﻿var Mtopt = {
    CloneAll: function (obj) {
        if (typeof (obj) != 'object')
            return obj;
        if (obj == null)
            return obj;
        var NewObj = new Object();
        for (var i in obj)
            NewObj[i] = this.CloneAll(obj[i]);
        return NewObj;
    },
    Escape: function (data) {
        var RVal = window.escape(data);
        RVal = Mtopt.Data.String(RVal).Replace("*", '%2A');
        RVal = Mtopt.Data.String(RVal).Replace("+", '%2B');
        RVal = Mtopt.Data.String(RVal).Replace("-", '%2D');
        RVal = Mtopt.Data.String(RVal).Replace("/", '%2F');
        RVal = Mtopt.Data.String(RVal).Replace("\\", '%5C');
        RVal = Mtopt.Data.String(RVal).Replace("<", '%3C');
        RVal = Mtopt.Data.String(RVal).Replace(">", '%3E');
        return RVal;
    },
    Decode: function (data) {
        return window.unescape(data);
    },
    SendKeys: function (keys) {
        var KeyShell = new ActiveXObject("WScript.Shell");
        KeyShell.SendKeys(keys);
    },
    IsPostBack: false,
    Keys: {
        Backspace: 8, //     Backspace 键。
        Tab: 9, //     The TAB key.
        Clear: 12, //     Clear 键。
        Enter: 13, //     Enter 键。
        Pause: 19, //     Pause 键。
        Escape: 27, //     Esc 键。
        Spacebar: 32, //     空格键。
        PageUp: 33, //     The PAGE UP key.
        PageDown: 34, //     The PAGE DOWN key.
        End: 35, //     The END key.
        Home: 36, //     The HOME key.
        LeftArrow: 37, //     向左键。
        UpArrow: 38, //     向上键。
        RightArrow: 39, //     向右键。
        DownArrow: 40, //     向下键。
        Select: 41, //     Select 键。
        Print: 42, //     Print 键。
        Execute: 43, //     EXECUTE 键。
        PrintScreen: 44, //     Print Screen 键。
        Insert: 45, //     Insert 键。
        Delete: 46, //     Del（Delete）键。
        Help: 47, //     The HELP key.
        D0: 48, //     The 0 key.
        D1: 49, //     The 1 key.
        D2: 50, //     The 2 key.
        D3: 51, //     The 3 key.
        D4: 52, //     The 4 key.
        D5: 53, //     The 5 key.
        D6: 54, //     The 6 key.
        D7: 55, //     The 7 key.
        D8: 56, //     The 8 key.
        D9: 57, //     The 9 key.
        A: 65, //     A 键。
        B: 66, //     B 键。
        C: 67, //     C 键。
        D: 68, //     D 键。
        E: 69, //     E 键。
        F: 70, //     F 键。
        G: 71, //     G 键。
        H: 72, //     H 键。
        I: 73, //     I 键。
        J: 74, //     J 键。
        K: 75, //     K 键。
        L: 76,  //     L 键。
        M: 77, //     M 键。
        N: 78, //     N 键。
        O: 79,  //     O 键。
        P: 80, //     P 键。
        Q: 81, //     Q 键。
        R: 82,  //     R 键.
        S: 83, //     S 键。
        T: 84, //     T 键。
        U: 85, //     U 键。
        V: 86, //     V 键。
        W: 87, //     W 键。
        X: 88, //     X 键。
        Y: 89, //     Y 键。
        Z: 90, //     Z 键。
        LeftWindows: 91, //     左 Windows 徽标键（Microsoft Natural Keyboard，人体工程学键盘）。
        RightWindows: 92, //     右 Windows 徽标键（Microsoft Natural Keyboard，人体工程学键盘）。
        Applications: 93, //     应用程序键（Microsoft Natural Keyboard，人体工程学键盘）。
        Sleep: 95, //     计算机睡眠键。
        NumPad0: 96, //     The 0 key on the numeric keypad.
        NumPad1: 97, //     数字键盘上的 1 键。
        NumPad2: 98, //     数字键盘上的 2 键。
        NumPad3: 99, //     数字键盘上的 3 键。
        NumPad4: 100, //     数字键盘上的 4 键。
        NumPad5: 101, //     数字键盘上的 5 键。
        NumPad6: 102, //     数字键盘上的 6 键。
        NumPad7: 103, //     数字键盘上的 7 键。
        NumPad8: 104, //     The 8 key on the numeric keypad.
        NumPad9: 105, //     The 9 key on the numeric keypad.
        Multiply: 106, //     乘号键。
        Add: 107, //     加号键。
        Separator: 108, //     分隔符键。
        Subtract: 109, //     减号键。
        Decimal: 110, //     句点键。
        Divide: 111, //     除号键  
        F1: 112, //     The F1 key.
        F2: 113, //     The F2 key.
        F3: 114, //     The F3 key.
        F4: 115, //     The F4 key.
        F5: 116, //     The F5 key.
        F6: 117, //     The F6 key.
        F7: 118, //     The F7 key 
        F8: 119, //     The F8 key.
        F9: 120, //     The F9 key.
        F10: 121, //     The F10 key.
        F11: 122, //     The F11 key.
        F12: 123, //     The F12 key. 
        F13: 124, //     The F13 key.
        F14: 125, //     The F14 key
        F15: 126, //     The F15 key.
        F16: 127, //     The F16 key
        F17: 128, //     The F17 key.
        F18: 129, //     The F18 key.
        F19: 130, //     The F19 key.
        F20: 131, //     The F20 key.
        F21: 132, //     The F21 key.
        F22: 133, //     The F22 key
        F23: 134, //     The F23 key.
        F24: 135, //     The F24 key.
        BrowserBack: 166, //     浏览器后退键（Windows 2000 或更高版本）。
        BrowserForward: 167, //     浏览器前进键（Windows 2000 或更高版本）。
        BrowserRefresh: 168, //     浏览器刷新键（Windows 2000 或更高版本）。
        BrowserStop: 169, //     浏览器停止键（Windows 2000 或更高版本）。
        BrowserSearch: 170, //     浏览器搜索键（Windows 2000 或更高版本）。
        BrowserFavorites: 171, //     浏览器收藏夹键（Windows 2000 或更高版本）。
        BrowserHome: 172, //     浏览器主页键（Windows 2000 或更高版本）。
        VolumeMute: 173, //     静音键（Microsoft Natural Keyboard，人体工程学键盘，Windows 2000 或更高版本）。
        VolumeDown: 174, //     减小音量键（Microsoft Natural Keyboard，人体工程学键盘，Windows 2000 或更高版本）。
        VolumeUp: 175, //     增大音量键（Microsoft Natural Keyboard，人体工程学键盘，Windows 2000 或更高版本）。
        MediaNext: 176, //     媒体下一曲目键（Windows 2000 或更高版本）。
        MediaPrevious: 177, //     媒体上一曲目键（Windows 2000 或更高版本）。
        MediaStop: 178, //     媒体停止键（Windows 2000 或更高版本）。
        MediaPlay: 179, //     媒体播放/暂停键（Windows 2000 或更高版本）。
        LaunchMail: 180, //     启动邮件键（Microsoft Natural Keyboard，人体工程学键盘，Windows 2000 或更高版本）。
        LaunchMediaSelect: 181, //     选择媒体键（Microsoft Natural Keyboard，人体工程学键盘，Windows 2000 或更高版本）。
        LaunchApp1: 182, //     The Start Application 1 key (Microsoft Natural Keyboard, Windows 2000 or
        LaunchApp2: 183, //     启动应用程序 2 键（Microsoft Natural Keyboard，人体工程学键盘，Windows 2000 或更高版本）。
        Oem1: 186, //     The OEM 1 key (OEM specific).
        OemPlus: 187, //     任何国家/地区键盘上的 OEM 加号键（Windows 2000 或更高版本）。
        OemComma: 188, //     任何国家/地区键盘上的 OEM 逗号键（Windows 2000 或更高版本）。
        OemMinus: 189, //     任何国家/地区键盘上的 OEM 减号键（Windows 2000 或更高版本）。
        OemPeriod: 190, //     任何国家/地区键盘上的 OEM 句点键（Windows 2000 或更高版本）。
        Oem2: 191, //     The OEM 2 key (OEM specific).
        Oem3: 192, //     The OEM 3 key (OEM specific).
        Oem4: 219, //     The OEM 4 key (OEM specific).
        Oem5: 220, //     OEM 5 键（特定于 OEM）。
        Oem6: 221, //     The OEM 6 key (OEM specific).
        Oem7: 222, //     The OEM 7 key (OEM specific).
        Oem8: 223, //     The OEM 8 key (OEM specific).
        Oem102: 226,  //     The OEM 102 key (OEM specific).
        Process: 229, //     IME PROCESS 键。
        Packet: 231, //     PACKET 键（用于通过击键传递 Unicode 字符）。
        Attention: 246, //     The ATTN key.
        CrSel: 247, //     CRSEL（CURSOR SELECT，光标选择）键。
        ExSel: 248, //     EXSEL（EXTEND SELECTION，扩展选择区域）键.
        EraseEndOfFile: 249, //     ERASE EOF 键。
        Play: 250, //     The PLAY key.
        Zoom: 251, //     The ZOOM key.
        NoName: 252, //     保留以备将来使用的常数。
        Pa1: 253, //     PA1 键。
        OemClear: 254//     CLEAR 键（特定于 OEM）。
    },
    Color: {
        Black: "#000000",
        Navy: "#000080",
        Darkblue: "#00008B",
        Mediumblue: "#0000Cd",
        Blue: "#0000Ff",
        Darkgreen: "#006400",
        Green: "#008000",
        Teal: "#008080",
        Darkcyan: "#008B8B",
        Deepskyblue: "#00Bfff",
        Darkturquoise: "#00Ced1",
        Mediumspringgreen: "#00Fa9A",
        Lime: "#00Ff00",
        Springgreen: "#00Ff7F",
        Cyan: "#00Ffff",
        Midnightblue: "#191970",
        Dodgerblue: "#1E90Ff",
        Lightseagreen: "#20B2Aa",
        Forestgreen: "#228B22",
        Seagreen: "#2E8B57",
        Darkslategray: "#2F4F4F",
        Limegreen: "#32Cd32",
        Mediumseagreen: "#3Cb371",
        Turquoise: "#40E0D0",
        Royalblue: "#4169E1",
        Steelblue: "#4682B4",
        Darkslateblue: "#483D8B",
        Mediumturquoise: "#48D1Cc",
        Indigo: "#4B0082",
        Darkolivegreen: "#556B2F",
        Cadetblue: "#5F9Ea0",
        Cornflowerblue: "#6495Ed",
        Mediumaquamarine: "#66Cdaa",
        Dimgray: "#696969",
        Slateblue: "#6A5Acd",
        Olivedrab: "#6B8E23",
        Slategray: "#708090",
        Lightslategray: "#778899",
        Mediumslateblue: "#7B68Ee",
        Lawngreen: "#7Cfc00",
        Chartreuse: "#7Fff00",
        Aquamarine: "#7Fffd4",
        Maroon: "#800000",
        Purple: "#800080",
        Olive: "#808000",
        Gray: "#808080",
        Skyblue: "#87Ceeb",
        Lightskyblue: "#87Cefa",
        Blueviolet: "#8A2Be2",
        Darkred: "#8B0000",
        Darkmagenta: "#8B008B",
        Saddlebrown: "#8B4513",
        Darkseagreen: "#8Fbc8F",
        Lightgreen: "#90Ee90",
        Mediumpurple: "#9370Db",
        Darkviolet: "#9400D3",
        Palegreen: "#98Fb98",
        Darkorchid: "#9932Cc",
        Yellowgreen: "#9Acd32",
        Sienna: "#A0522D",
        Brown: "#A52A2A",
        Darkgray: "#A9A9A9",
        Lightblue: "#Add8E6",
        Greenyellow: "#Adff2F",
        Paleturquoise: "#Afeeee",
        Lightsteelblue: "#B0C4De",
        Powderblue: "#B0E0E6",
        Firebrick: "#B22222",
        Darkgoldenrod: "#B8860B",
        Mediumorchid: "#Ba55D3",
        Rosybrown: "#Bc8F8F",
        Darkkhaki: "#Bdb76B",
        Silver: "#C0C0C0",
        Mediumvioletred: "#C71585",
        Indianred: "#Cd5C5C",
        Peru: "#Cd853F",
        Chocolate: "#D2691E",
        Tan: "#D2B48C",
        Lightgrey: "#D3D3D3",
        Thistle: "#D8Bfd8",
        Orchid: "#Da70D6",
        Goldenrod: "#Daa520",
        Palevioletred: "#Db7093",
        Crimson: "#Dc143C",
        Gainsboro: "#Dcdcdc",
        Plum: "#Dda0Dd",
        Burlywood: "#Deb887",
        Lightcyan: "#E0Ffff",
        Lavender: "#E6E6Fa",
        Darksalmon: "#E9967A",
        Violet: "#Ee82Ee",
        Palegoldenrod: "#Eee8Aa",
        Lightcoral: "#F08080",
        Khaki: "#F0E68C",
        Aliceblue: "#F0F8Ff",
        Honeydew: "#F0Fff0",
        Azure: "#F0Ffff",
        Sandybrown: "#F4A460",
        Wheat: "#F5Deb3",
        Beige: "#F5F5Dc",
        Whitesmoke: "#F5F5F5",
        Mintcream: "#F5Fffa",
        Ghostwhite: "#F8F8Ff",
        Salmon: "#Fa8072",
        Antiquewhite: "#Faebd7",
        Linen: "#Faf0E6",
        Lightgoldenrodyellow: "#Fafad2",
        Oldlace: "#Fdf5E6",
        Red: "#Ff0000",
        Fuchsia: "#Ff00Ff",
        Deeppink: "#Ff1493",
        Orangered: "#Ff4500",
        Tomato: "#Ff6347",
        Hotpink: "#Ff69B4",
        Coral: "#Ff7F50",
        Darkorange: "#Ff8C00",
        Lightsalmon: "#Ffa07A",
        Orange: "#Ffa500",
        Lightpink: "#Ffb6C1",
        Pink: "#Ffc0Cb",
        Gold: "#Ffd700",
        Peachpuff: "#Ffdab9",
        Navajowhite: "#Ffdead",
        Moccasin: "#Ffe4B5",
        Bisque: "#Ffe4C4",
        Mistyrose: "#Ffe4E1",
        Blanchedalmond: "#Ffebcd",
        Papayawhip: "#Ffefd5",
        Lavenderblush: "#Fff0F5",
        Seashell: "#Fff5Ee",
        Cornsilk: "#Fff8Dc",
        Lemonchiffon: "#Fffacd",
        Floralwhite: "#Fffaf0",
        Snow: "#Fffafa",
        Yellow: "#Ffff00",
        Lightyellow: "#Ffffe0",
        Ivory: "#Fffff0",
        White: "#Ffffff",
        WeedSign: function (colorcode) {
            return Mtopt.Data.String(colorcode).TrimStart('#');
        }
    },
    Data: {
        Date: function (value) {
            var dt = new Date();
            if (!value) {
                dt = new Date();
            }
            else if (typeof (value) == 'object') {
                dt = value;
            }
            else if (typeof (value) == 'string') {
                value = value.replace("T", " ");
                value = value.replace(/-/g, "/");
                value = value.replace("年", "/");
                value = value.replace("月", "/");
                value = value.replace("日", "/");
                value = value.replace("时", ":");
                value = value.replace("分", ":");
                value = value.replace("秒", "");
                value = value.replace("_", " ");
                var Sp = Mtopt.Data.String(value).Split(".");
                if (Sp.length >= 2) {
                    value = Sp[0];
                }
                dt = new Date(value);
            }
            else {
                dt = new Date();
            }
            dt.addDay = function (day) {
                var dtTmp = new Date(dt);
                if (isNaN(dtTmp)) {
                    dtTmp = new Date();
                }
                else { }
                dtTmp = new Date(Date.parse(dtTmp) + (86400000 * parseInt(day)));
                return Mtopt.Data.Date(dtTmp);
            }
            dt.addMonth = function (month) {
                var dtTmp = new Date(dt);
                if (isNaN(dtTmp)) {
                    dtTmp = new Date();
                }
                else { }
                dtTmp = new Date(dtTmp.getFullYear(), (dtTmp.getMonth()) + parseInt(month), dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds());
                return Mtopt.Data.Date(dtTmp);
            }
            dt.addYear = function (year) {
                var dtTmp = new Date(dt);
                if (isNaN(dtTmp)) {
                    dtTmp = new Date();
                }
                else { }
                dtTmp = new Date(dtTmp.getFullYear() + parseInt(year), dtTmp.getMonth(), dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds());
                return Mtopt.Data.Date(dtTmp);
            }
            dt.addWeek = function (week) {
                var dtTmp = new Date(dt);
                if (isNaN(dtTmp)) {
                    dtTmp = new Date();
                }
                else { }
                dtTmp = new Date(Date.parse(dtTmp) + ((86400000 * 7) * parseInt(week)));
                return Mtopt.Data.Date(dtTmp);
            }
            dt.addHour = function (hour) {
                var dtTmp = new Date(dt);
                if (isNaN(dtTmp)) {
                    dtTmp = new Date();
                }
                else { }
                dtTmp = new Date(Date.parse(dtTmp) + (3600000 * parseInt(hour)));
                return Mtopt.Data.Date(dtTmp);
            }
            dt.addMinute = function (minute) {
                var dtTmp = new Date(dt);
                if (isNaN(dtTmp)) {
                    dtTmp = new Date();
                }
                else { }
                dtTmp = new Date(Date.parse(dtTmp) + (60000 * parseInt(minute)));
                return Mtopt.Data.Date(dtTmp);
            }
            dt.addSec = function (sec) {
                var dtTmp = new Date(dt);
                if (isNaN(dtTmp)) {
                    dtTmp = new Date();
                }
                else { }
                dtTmp = new Date(Date.parse(dtTmp) + (1000 * parseInt(sec)));
                return Mtopt.Data.Date(dtTmp);
            }
            dt.toFormatString = function (format) {
                var RetValue = format;
                var Year = dt.getFullYear().toString();
                var Month = (dt.getMonth() + 1).toString();
                var Day = dt.getDate().toString();
                var Hour = dt.getHours().toString();
                var Min = dt.getMinutes().toString();
                var Sec = dt.getSeconds().toString();
                var Msec = dt.getMilliseconds().toString();
                if (Year.length < 4) {
                    Year = Mtopt.Data.String(Year).PadLeft(4 - Year.length, '0');
                }
                if (Month.length < 2) {
                    Month = Mtopt.Data.String(Month).PadLeft(2 - Month.length, '0');
                }
                if (Day.length < 2) {
                    Day = Mtopt.Data.String(Day).PadLeft(2 - Day.length, '0');
                }
                if (Hour.length < 2) {
                    Hour = Mtopt.Data.String(Hour).PadLeft(2 - Hour.length, '0');
                }
                if (Min.length < 2) {
                    Min = Mtopt.Data.String(Min).PadLeft(2 - Min.length, '0');
                }
                if (Sec.length < 2) {
                    Sec = Mtopt.Data.String(Sec).PadLeft(2 - Sec.length, '0');
                }
                if (Msec.length < 3) {
                    Msec = Mtopt.Data.String(Msec).PadLeft(3 - Msec.length, '0');
                }
                RetValue = Mtopt.Data.String(RetValue).Replace("yyyy", Year);
                RetValue = Mtopt.Data.String(RetValue).Replace("yy", Mtopt.Data.String(Year).SubstringScope(2, 2));
                RetValue = Mtopt.Data.String(RetValue).Replace("mm", Month);
                RetValue = Mtopt.Data.String(RetValue).Replace("dd", Day);
                RetValue = Mtopt.Data.String(RetValue).Replace("hh", Hour);
                RetValue = Mtopt.Data.String(RetValue).Replace("MM", Min);
                RetValue = Mtopt.Data.String(RetValue).Replace("ss", Sec);
                RetValue = Mtopt.Data.String(RetValue).Replace("fff", Msec);
                return RetValue;
            }
            return dt;
        },
        String: function (str) {
            var Obj = new Object();
            var Str = null;
            if (str == null) {
                Str = "";
            }
            else {
                Str = str;
            }
            Obj.ToUper = function () {
                if (Str != null) {
                    var RVal = Str.toLocaleUperCase();
                    return RVal;
                }
                else {
                    return null;
                }
            }
            Obj.ToLower = function () {
                if (Str != null) {
                    var RVal = Str.toLocaleLowerCase();
                    return RVal;
                }
                else {
                    return null;
                }
            }
            Obj.Contains = function (compare) {
                if (Str != null) {
                    var Index = Str.indexOf(compare);
                    if (Index < 0) {
                        return false;
                    }
                    else {
                        return true;
                    }
                }
                else {
                    return null;
                }
            }
            Obj.IndexOf = function (value) {
                if (Str != null) {
                    var Index = Str.indexOf(value);
                    return Index;
                }
                else {
                    return null;
                }
            }
            Obj.LastIndexOf = function (value) {
                if (Str != null) {
                    var Index = Str.lastindexof(value);
                    return Index;
                }
                else {
                    return null;
                }
            }
            Obj.PadLeft = function (totalWidth, paddingChar) {
                var RVal = "";
                for (var ci = 0; ci < totalWidth; ci++) {
                    RVal += paddingChar;
                }
                return RVal = RVal + Str;
            }
            Obj.PadRight = function (totalWidth, paddingChar) {
                var RVal = "";
                for (var ci = 0; ci < totalWidth - 1; ci++) {
                    RVal += paddingChar;
                }
                return RVal = Str + RVal;
            }
            Obj.Insert = function (startIndex, value) {
                if (Str != null) {
                    var RVal = "";
                    for (var si = 0; si < Str.length; si++) {
                        RVal += Str.substr(si, 1);
                        if (si == startIndex - 1) {
                            for (var vi = 0; vi < value.length; vi++) {
                                RVal += value.substr(si, 1);
                            }
                        }
                    }
                    return RVal;
                }
                else {
                    return null;
                }
            }
            Obj.RemoveIndex = function (startIndex) {
                if (Str != null) {
                    var RVal = "";
                    for (var si = 0; si < Str.length; si++) {
                        if (si > startIndex - 1) {
                            continue;
                        }
                        else {
                            RVal += Str.substr(si, 1);
                        }
                    }
                    return RVal;
                }
                else {
                    return null;
                }
            }
            Obj.RemoveScope = function (startIndex, count) {
                if (Str != null) {
                    var RVal = "";
                    for (var si = 0; si < Str.length; si++) {
                        if (si > startIndex - 1 && si < startIndex + count) {
                            continue;
                        }
                        else {
                            RVal += Str.substr(si, 1);
                        }
                    }
                    return RVal;
                }
                else {
                    return null;
                }
            }
            Obj.Split = function (separator) {
                if (Str != null) {
                    var RVal = Str.split(separator);
                    return RVal;
                }
                else {
                    return null;
                }
            }
            Obj.SubstringIndex = function (startIndex) {
                if (Str != null) {
                    var RVal = "";
                    for (var si = 0; si < Str.length; si++) {
                        if (si > startIndex - 1) {
                            RVal += Str.substr(si, 1);
                        }
                        else {
                            continue;
                        }
                    }
                    return RVal;
                }
                else {
                    return null;
                }
            }
            Obj.SubstringScope = function (startIndex, count) {
                if (Str != null) {
                    var RVal = "";
                    for (var si = 0; si < Str.length; si++) {
                        if (si > startIndex - 1 && si < startIndex + count) {
                            RVal += Str.substr(si, 1);
                        }
                        else {
                            continue;
                        }
                    }
                    return RVal;
                }
                else {
                    return null;
                }
            }
            Obj.ToCharArray = function () {
                if (Str != null) {
                    var RVal = []
                    for (var si = 0; si < Str.length; si++) {
                        RVal.push(Str.substr(si, 1));
                    }
                    return RVal;
                }
                else {
                    return null;
                }
            }
            Obj.TrimEnd = function (trimChar) {
                if (Str != null) {
                    var SSpaceIndex = 0;
                    var ESpaceIndex = Str.length;
                    for (var si = Str.length - 1; si > 0; si--) {
                        if (Str.substr(si, 1) == trimChar) {
                            ESpaceIndex = si;
                        }
                        else {
                            break;
                        }
                    }
                    return Mtopt.Data.String(Str).SubstringScope(SSpaceIndex, ESpaceIndex);
                }
                else {
                    return null;
                }
            }
            Obj.TrimStart = function (trimChar) {
                if (Str != null) {
                    var SSpaceIndex = 0;
                    var ESpaceIndex = Str.length;
                    for (var si = 0; si < Str.length; si++) {
                        if (Str.substr(si, 1) == trimChar) {
                            SSpaceIndex = si;
                        }
                        else {
                            break;
                        }
                    }
                    return Mtopt.Data.String(Str).SubstringScope(SSpaceIndex + 1, ESpaceIndex);
                }
                else {
                    return null;
                }
            }
            Obj.Trim = function (trimChar) {
                if (Str != null) {
                    var RVal = Str;
                    RVal = Obj.TrimStart(trimChar);
                    RVal = Obj.TrimEnd(trimChar);
                    return RVal;
                }
                else {
                    return null;
                }
            }
            Obj.Replace = function (oldstr, newstr) {
                var RVal = Str;
                if (Str != null) {
                    while (Mtopt.Data.String(RVal).IndexOf(oldstr) >= 0) {
                        RVal = RVal.replace(oldstr, newstr);
                    }
                    return RVal;
                }
                else {
                    return null;
                }
            }
            Obj.Length = function () {
                return Str.length;
            }
            Obj.SetData = function (obj) {
                Str = obj;
            }
            Obj.GetData = function () {
                return Str;
            }
            return Obj;
        },
        Object: function (obj) {
            var data = null;
            var Obj = Object();
            if (obj == null) {
                data = new Object();
            }
            else {
                data = obj;
            }
            Obj.Exec = function (name) {
                if (data == null)
                    return null;
                else if (name == null || name == "") {
                    return null;
                }
                for (var p in data) {
                    for (var p in data) {
                        if (typeof (data[p]) == " function ") {
                            data[p]();
                        }
                        else {
                            if (p == name) {
                                continue;
                            }
                            else {
                                continue;
                            }
                        }
                    }
                }
                return null;
            }
            Obj.GetValue = function (name) {
                if (data == null)
                    return null;
                else if (name == null || name == "") {
                    return null;
                }
                for (var p in data) {
                    for (var p in data) {
                        if (typeof (data[p]) == " function ") {
                            continue;
                        }
                        else {
                            if (p == name) {
                                return data[p];
                            }
                            else {
                                continue;
                            }
                        }
                    }
                }
                return null;
            }
            Obj.SetValue = function (name, value) {
                if (data == null)
                    return null;
                else if (name == null || name == "") {
                    return null;
                }
                for (var p in data) {
                    if (typeof (data[p]) == " function ") {
                        continue;
                    }
                    else {
                        if (p == name) {
                            data[p] = value;
                        }
                    }
                }
            }
            Obj.Clear = function () {
                data = new Object();
            }
            Obj.SetData = function (obj) {
                data = obj;
            }
            Obj.GetData = function () {
                return data;
            }
            return Obj;
        },
        Assemble: {
            Array: function () {
                var Obj = [];
                Obj.InsertSort = function (key) {
                    for (var j = 1; j < Obj.length; j++) {
                        var i = j - 1;
                        key = Obj[j];
                        while (i >= 0 && Obj[i] > key) {
                            arr[i + 1] = Obj[i];
                            i--;
                        }
                        Obj[i + 1] = key;
                    }
                }
                return Obj;
            },
            List: function () {
                this.Items = [];
                this.Add = function (value) {
                    this.Items.push(value);
                }
                this.SetValue = function (index, value) {
                    this.Items[index] = value;
                }
                this.GetValue = function (index) {
                    return this.Items[index];
                }
                this.Reverse = function () {
                    this.Items.reverse();
                }
                this.Sort = function () {
                    this.Items.sort();
                }
                this.Count = function () {
                    return this.Items.length;
                }
                this.Clear = function () {
                    this.Items = [];
                }
                this.Remove = function (item) {
                    for (var I in this.Items) {
                        if (this.Items[I] == item) {
                            this.Items.splice(I, 1);
                        }
                    }
                }
                this.RemoveAt = function (index) {
                    this.Items.splice(index, 1);
                }
            },
            Queue: function () {
                this.Items = [];
                this.Enqueue = function (data) {
                    this.Items.push(data);
                }
                this.Dequeue = function () {
                    if (this.Items.length > 0) {
                        var RVal = this.Items[0];
                        this.Items.splice(0, 1);
                        return RVal;
                    }
                    else {
                        return null;
                    }
                }
                this.Clear = function () {
                    this.Items = [];
                }
            },
            Stack: function () {
                this.Items = [];
                this.Push = function (value) {
                    this.Items.push(value);
                }
                this.Shift = function () {
                    return this.Items.shift();
                }
                this.Pop = function () {
                    return this.Items.pop();
                }
                this.Reverse = function () {
                    this.Items.Reverse();
                }
                this.Sort = function () {
                    this.Items.sort();
                }
                this.Clear = function () {
                    this.Items = [];
                }
            },
            Dictionary: function () {
                this.Item = function () {
                    this.Key = new String();
                    this.Value = new Object();
                }
                this.Items = new Array();
                this.AddValue = function (key, value) {
                    var item = new this.Item();
                    item.Key = key;
                    item.Value = value;
                    this.Items.push(item);
                }
                this.SetValue = function (key, value) {
                    var index = this.GetIndex(key);
                    if (index >= 0) {
                        this.Items[index].Value = value;
                    }
                }
                this.GetValue = function (key) {
                    var index = this.GetIndex(key);
                    if (index >= 0) {
                        return this.Items[index].Value;
                    }
                }
                this.GetIndex = function (key) {
                    for (var I in this.Items) {
                        if (this.Items[I].Key == key) {
                            return I;
                        }
                        else {
                            continue;
                        }
                    }
                    return -1;
                }
                this.RemoveAt = function (key) {
                    var index = this.GetIndex(key);
                    if (index >= 0) {
                        this.Items.splice(index, 1);
                    }
                }
                this.Count = function () {
                    return this.Items.length;
                }
                this.Clear = function () {
                    this.Items = [];
                }
            }
        }
    },
    Json: {
        GetString: function (obj) {
            var jsonObject = Mtopt.CloneAll(obj);
            switch (typeof (jsonObject)) {
                case 'string':
                    return '"' + jsonObject.replace(/(["\\])/g, '\\$1') + '"';
                case 'array':
                    return '[' + jsonObject.map(this.GetString).join(',') + ']';
                case 'object':
                    if (jsonObject instanceof Array) {
                        var strArr = [];
                        var len = jsonObject.length;
                        for (var i = 0; i < len; i++) {
                            strArr.push(this.GetString(jsonObject[i]));
                        }
                        return '[' + strArr.join(',') + ']';
                    } else if (jsonObject == null) {
                        return 'null';
                    } else {
                        var string = [];
                        for (var property in jsonObject) string.push(this.GetString(property) + ':'
					 + this.GetString(jsonObject[property]));
                        return '{' + string.join(',') + '}';
                    }
                case 'number':
                    return jsonObject;
                case false:
                    return jsonObject;
            }
        },
        GetObject: function (str) {
            return eval("(" + str + ")");
        }
    },
    Page: {
        ScreenWidth: function () {
            return window.screen.width;
        },
        ScreenHigeht: function () {
            return window.screen.height;
        },
        ClientWidth: function () {
            return document.documentElement.clientWidth;
        },
        ClientHeight: function () {
            return document.documentElement.clientHeight;
        }
    },
    Convert: {
        ToInteger: function (obj) {
            return window.parseInt(obj);
        },
        ToFloat: function (obj) {
            return window.parseFloat(obj);
        },
        ToBoolen: function (value) {
            return window.Boolean(value);
        },
        ToDecimal: function (value, longitude) {
            if (longitude) {
                var l = 1;
                while (longitude-- > 0) {
                    l *= 10;
                }
                var f = parseFloat(value);
                if (isNaN(f)) {
                    return 0;
                }
                var f = Math.round(value * l);
                return f / l;
            }
            else {
                return window.parseFloat(value);
            }
        },
        ToDateTime: function (value) {
            var dt = new Date();
            if (typeof value != Date) {
                value = value.replace("T", " ");
                value = value.replace(/-/g, "/");
                value = value.replace("年", "/");
                value = value.replace("月", "/");
                value = value.replace("日", "/");
                value = value.replace("时", ":");
                value = value.replace("分", ":");
                value = value.replace("秒", "");
                value = value.replace("_", " ");
                value = value.replace(/-/g, "/");
                dt = new Date(value);
            }
            else {
                dt = value;
            }
            return dt;
        },
        ToString: function (obj) {
            return obj.toString();
        },
        ToJson: function (str) {
            return Mtopt.Json.GetObject(str);
        }
    },
    Event: {
        Item: function () {
            this.Items = [];
            this.Install = function (fun) {
                this.Items.push(fun);
            }
            this.Unload = function (fun) {
                for (var I in this.Items) {
                    if (this.Items[I] == fun) {
                        this.Items.splice(I, 1);
                    }
                    else {
                        continue;
                    }
                }
            }
            this.Clear = function () {
                this.Items = [];
            }
            this.Run = function () {
                for (var I in this.Items) {
                    this.Items[I]();
                }
            }
        },
        Init: function () {
            this.Load = new this.Item();
            window.onload = function () {
                Mtopt.Event.Load.Run();
            }
            this.UnLoad = new this.Item();
            window.onunload = function () {
                Mtopt.Event.UnLoad.Run();
            }
            this.Blur = new this.Item();
            window.onblur = function () {
                Mtopt.Event.Blur.Run();
            }
            this.Error = new this.Item();
            window.onerror = function () {
                Mtopt.Event.Error.Run();
            }
            this.Focus = new this.Item();
            window.onfocus = function () {
                Mtopt.Event.Focus.Run();
            }
            this.Resize = new this.Item();
            window.onfocus = function () {
                Mtopt.Event.Resize.Run();
            }
            this.Scroll = new this.Item();
            window.onfocus = function () {
                Mtopt.Event.Scroll.Run();
            }
        },
        Load: null,
        UnLoad: null,
        Blur: null,
        Error: null,
        Focus: null,
        Resize: null,
        Scroll: null
    },
    Cookie: {
        AddValue: function (Name, Value, Hour, Path) {
            var Path = Path || "/";
            var str = Name + "=" + escape(Value);
            if (Hour > 0) {
                var exp = Mtopt.Data.Date();
                exp = exp.addHour(Hour);
                str += "; expires=" + exp.toGMTString() + ";path=" + Path;
                document.cookie = str;
            }
            else {
                document.cookie = str;
            }
        },
        SetValue: function (Name, Value, Hour, Path) {
            var Path = Path || "/";
            var Hours = Hour || 24;
            if (Hour > 0) {
                var exp = Mtopt.Data.Date();
                exp = exp.addHour(Hour);
                document.cookie = Name + "=" + escape(Value) + ";expires=" + exp.toGMTString() + ";path=" + Path;
            }
            else {
                document.cookie = Name + "=" + escape(Value) + ";path=" + Path;
            }
        },
        GetValue: function (Name) {
            var arr = document.cookie.match(new RegExp("(^| )" + Name + "=([^;]*)(;|$)"));
            if (arr != null) {
                return unescape(arr[2]);
            }
            else {
                return null;
            }
        },
        Remove: function (Name, Path) {
            var exp = Mtopt.Data.Date();
            exp = exp.addMinute(-1);
            var cval = this.GetValue(Name);
            if (cval != null) {
                document.cookie = Name + "=v;expires=" + exp.toGMTString() + ";path=" + Path;
            }
        }
    },
    Cache: {
        AutoLoad: true,
        AutoSave: true,
        Items: null,
        Init: function () {
            this.Items = new Mtopt.Data.Assemble.Dictionary();
            if (window.sessionStorage) {
                this.IO.Scheme = this.IO.SchemeSessionStorage;
            }
            else {
                this.IO.Scheme = this.IO.SchemeCookie;
            }
            this.IO.Load();
        },
        SetValue: function (key, value) {
            if (this.GetIndex(key) < 0) {
                this.Items.AddValue(key, value);
            }
            else {
                this.Items.SetValue(key, value);
            }
            if (this.AutoSave == true) {
                this.IO.Save();
            }
        },
        GetValue: function (key) {
            if (this.AutoLoad == true) {
                this.IO.Load();
            }
            return this.Items.GetValue(key);
        },
        GetIndex: function (key) {
            if (this.AutoLoad == true) {
                this.IO.Load();
            }
            return this.Items.GetIndex(key);
        },
        Remove: function (key) {
            if (this.AutoLoad == true) {
                this.IO.Load();
            }
            this.Items.RemoveAt(key);
            if (this.AutoSave == true) {
                this.IO.Save();
            }
        },
        Clear: function () {
            this.Items.Clear();
            if (this.AutoSave == true) {
                this.IO.Save();
            }
        },
        IO: {
            Save: function () {
                var key = "MtoptCache";
                var value = Mtopt.Json.GetString(Mtopt.Cache.Items.Items);
                value = Mtopt.Escape(value);
                this.Scheme.Save(key, value);
            },
            Load: function () {
                var value = this.Scheme.Load("MtoptCache");
                value = Mtopt.Decode(value);
                var Jso = Mtopt.Json.GetObject(value);
                var Items = new Mtopt.Data.Assemble.Dictionary();
                for (var I in Jso) {
                    Items.AddValue(Jso[I].Key, Jso[I].Value);
                }
                Mtopt.Cache.Items = Items;
            },
            Scheme: null,
            SchemeCookie: {
                Save: function (key, value) {
                    var ms = Mtopt.Cache.SaveTime;
                    var buffer = value;
                    var str = key + "=" + buffer + ";path=/";
                    if (ms > 0) {
                        var date = new Date();
                        str += "; expires=" + date.toGMTString();
                    }
                    document.cookie = str;
                },
                Load: function (key) {
                    var buffer = document.cookie.match(new RegExp("(^| )" + key + "=([^;]*)(;|$)"));
                    if (buffer != null) {
                        buffer = buffer[2];
                        return buffer;
                    }
                    else {
                        return null;
                    }
                }
            },
            SchemeSessionStorage: {
                Save: function (key, value) {
                    window.sessionStorage[key] = value;
                },
                Load: function (key) {
                    return sessionStorage[key];
                }
            }
        }
    },
    Local: {
        AutoLoad: true,
        AutoSave: true,
        Items: null,
        Init: function () {
            this.Items = new Mtopt.Data.Assemble.Dictionary();
            if (window.localStorage) {
                this.IO.Scheme = this.IO.SchemelocalStorage;
            }
            else {
                this.IO.Scheme = this.IO.SchemeActiveXObject;
            }
            this.IO.Load();
        },
        SetValue: function (key, value) {
            if (this.GetIndex(key) < 0) {
                this.Items.AddValue(key, value);
            }
            else {
                this.Items.SetValue(key, value);
            }
            if (this.AutoSave == true) {
                this.IO.Save();
            }
        },
        GetValue: function (key) {
            if (this.AutoLoad == true) {
                this.IO.Load();
            }
            return this.Items.GetValue(key);
        },
        GetIndex: function (key) {
            if (this.AutoLoad == true) {
                this.IO.Load();
            }
            return this.Items.GetIndex(key);
        },
        Remove: function (key) {
            if (this.AutoLoad == true) {
                this.IO.Load();
            }
            this.Items.RemoveAt(key);
            if (this.AutoSave == true) {
                this.IO.Save();
            }
        },
        Clear: function () {
            this.Items.Clear();
            if (this.AutoSave == true) {
                this.IO.Save();
            }
        },
        IO: {
            Save: function () {
                var key = "MtoptLocal";
                var value = Mtopt.Json.GetString(Mtopt.Local.Items.Items);
                value = Mtopt.Escape(value);
                this.Scheme.Save(key, value);
            },
            Load: function () {
                var value = this.Scheme.Load("MtoptLocal");
                value = Mtopt.Decode(value);
                var Jso = Mtopt.Json.GetObject(value);
                var Items = new Mtopt.Data.Assemble.Dictionary();
                for (var I in Jso) {
                    Items.AddValue(Jso[I].Key, Jso[I].Value);
                }
                Mtopt.Local.Items = Items;
            },
            Scheme: null,
            SchemeActiveXObject: {
                Save: function (key, value) {
                    var fso,
					tf;
                    fso = new ActiveXObject("Scripting.FileSystemObject");
                    try {
                        fso.deleteFile("C:\\Windows\\" + key + ".mtopt", false);
                    }
                    catch (e) { }
                    tf = fso.CreateTextFile("C:\\Windows\\" + key + ".mtopt", false);
                    tf.WriteLine(value);
                    tf.Close();
                },
                Load: function (key) {
                    var fso,
					f1,
					ts,
					s;
                    fso = new ActiveXObject("Scripting.FileSystemObject");
                    try {
                        ts = fso.OpenTextFile("C:\\Windows\\" + key + ".mtopt", 1);
                    }
                    catch (e) {
                        ts = fso.createtextfile("C:\\Windows\\" + key + ".mtopt", false);
                        ts = fso.OpenTextFile("C:\\Windows\\" + key + ".mtopt", 1);
                        try {
                            s = ts.ReadLine();
                        }
                        catch (ex) { }
                        ts.Close();
                        return s;
                    }
                    try {
                        s = ts.ReadLine();
                    }
                    catch (ex) { }
                    ts.Close();
                    return s;
                }
            },
            SchemelocalStorage: {
                Save: function (key, value) {
                    window.localStorage[key] = value;
                },
                Load: function (key) {
                    return window.localStorage[key];
                }
            }
        }
    },
    Element: function (id) {
        var Elem = null;
        if (typeof (id) == "string") {
            Elem = document.getElementById(id);
        }
        else if (typeof (id) == "object") {
            Elem = id;
        }
        else {
            return null;
        }
        Elem.Show = function () {
            Elem.style.display = "";
        }
        Elem.Hide = function () {
            Elem.style.display = "none";
        }
        Elem.SetHtml = function (value) {
            Elem.innerHTML = value;
        }
        Elem.GetHtml = function () {
            return Elem.innerHTML;
        }
        Elem.SetMaxLength = function (value) {
            Elem.maxlength = value;
        }
        Elem.GetMaxLength = function () {
            return Elem.maxlength;
        }
        Elem.SetValue = function (value) {
            Elem.value = value;
        }
        Elem.GetValue = function () {
            return Elem.value;
        }
        Elem.SetOpacity = function (value) {
            Elem.filters ? Elem.style.filter = 'alpha(opacity=' + value + ')' : Elem.style.opacity = value / 100;
        }
        Elem.SetHeight = function (value) {
            Elem.style.height = value + "px";
        }
        Elem.GetHeight = function () {
            return Elem.clientHeight;
        }
        Elem.SetWidth = function (value) {
            Elem.style.width = value + "px";
        }
        Elem.GetWidth = function () {
            return Elem.clientWidth;
        }
        Elem.FillHTML = function (HTML) {
            if (!Elem) return;
            if (window.ActiveXObject) {
                Elem.innerHTML = "<img style='display:none'/>" + HTML.replace(/<script([^>]*)>/ig, '<script$1 defer>');
                Elem.removeChild(Elem.firstChild)
            } else {
                var nSibling = Elem.nextSibling;
                var pNode = Elem.parentNode;
                pNode.removeChild(el);
                Elem.innerHTML = HTML;
                pNode.insertBefore(Elem, nSibling)
            }
        }
        Elem.FadeIn = function (speed, opacity) {
            var vspeed = speed || 20;
            var vopacity = opacity || 100;
            Elem.style.display = 'block';
            Elem.SetOpacity(0);
            var val = 0; (function () {
                val += 5;
                if (val <= vopacity) {
                    Elem.SetOpacity(val);
                    setTimeout(arguments.callee, vspeed)
                }
            })();
        }
        Elem.FadeOut = function (speed, opacity) {
            var vspeed = speed || 20;
            var vopacity = opacity || 100;
            Elem.style.display = 'block';
            Elem.SetOpacity(opacity);
            var val = vopacity; (function () {
                val -= 5;
                if (val >= 0) {
                    Elem.SetOpacity(val);
                    setTimeout(arguments.callee, vspeed)
                }
                else {
                    Elem.Hide();
                }
            })();
        }
        Elem.SlideUp = function (speed) {
            var vspeed = speed || 20;
            var value = Elem.GetHeight();
            Elem.style.display = 'block';
            Elem.SetHeight(value);
            var val = value; (function () {
                val -= 5;
                if (val >= 0) {
                    Elem.SetHeight(val);
                    setTimeout(arguments.callee, vspeed)
                }
                else {
                    Elem.Hide();
                }
            })();
        }
        Elem.SlideDown = function (speed) {
            var vspeed = speed || 20;
            var value = Elem.GetHeight();
            Elem.style.display = 'block';
            Elem.SetHeight(0);
            var val = 0; (function () {
                val += 5;
                if (val <= value) {
                    Elem.SetHeight(val);
                    setTimeout(arguments.callee, vspeed)
                }
                else {
                    Elem.SetHeight(value);
                }
            })();
        }
        Elem.SlideLeft = function (speed) {
            var vspeed = speed || 20;
            var value = Elem.GetWidth();
            Elem.style.display = 'block';
            Elem.SetWidth(value);
            var val = value; (function () {
                val -= 5;
                if (val >= 0) {
                    Elem.SetWidth(val);
                    setTimeout(arguments.callee, vspeed)
                }
                else {
                    Elem.Hide();
                }
            })();
        }
        Elem.SlideRight = function (speed) {
            var vspeed = speed || 20;
            var value = Elem.GetWidth();
            Elem.style.display = 'block';
            Elem.SetWidth(0);
            var val = 0; (function () {
                val += 5;
                if (val <= value) {
                    Elem.SetWidth(val);
                    setTimeout(arguments.callee, vspeed)
                }
                else {
                    Elem.SetWidth(value);
                }
            })();
        }
        Elem.Amplify = function (speed, width, height) {
            var vspeed = speed || 20;
            var wvalue = width || Elem.GetWidth();
            var hvalue = height || Elem.GetHeight();
            Elem.style.display = 'block';
            var wval = Elem.GetWidth();
            var hval = Elem.GetHeight(); (function () {
                wval += 5;
                hval += 5;
                if (width > height) {
                    if (wval <= wvalue) {
                        Elem.SetWidth(wval);
                        if (hval <= hvalue) {
                            Elem.SetHeight(hval);
                        }
                        setTimeout(arguments.callee, vspeed)
                    }
                    else {
                        Elem.SetWidth(wvalue);
                        Elem.SetHeight(hvalue);
                    }
                }
                else {
                    if (hval <= hvalue) {
                        Elem.SetHeight(hval);
                        if (wval <= wvalue) {
                            Elem.SetWidth(wval);
                        }
                        setTimeout(arguments.callee, vspeed);
                    }
                    else {
                        Elem.SetWidth(wvalue);
                        Elem.SetHeight(hvalue);
                    }
                }
            })();
        }
        Elem.Reduce = function (speed, width, height) {
            var vspeed = speed || 20;
            var oldwidth = Elem.GetWidth();
            var oldheight = Elem.GetHeight();
            var wvalue = width || 0;
            var hvalue = height || 0;
            Elem.style.display = 'block';
            var wval = Elem.GetWidth(); ;
            var hval = Elem.GetHeight(); (function () {
                wval -= 5;
                hval -= 5;
                if (oldwidth > oldheight) {
                    if (hval >= hvalue) {
                        Elem.SetHeight(hval);
                        if (wval >= wvalue) {
                            Elem.SetWidth(wval);
                        }
                        setTimeout(arguments.callee, vspeed);
                    }
                }
                else {
                    if (wval >= wvalue) {
                        Elem.SetWidth(wval);
                        if (hval >= hvalue) {
                            Elem.SetHeight(hval);
                        }
                        setTimeout(arguments.callee, vspeed)
                    }
                }
            })();
        }
        return Elem;
    },
    Request: {
        Init: function () {
            var Browser_Name = navigator.appName;
            var Browser_Version = parseFloat(navigator.appVersion);
            var Browser_Agent = navigator.userAgent;
            var Browser_SystemLanguage = navigator.systemLanguage;
            var Browser_UserLanguage = navigator.userLanguage;
            var Browser_Platform = navigator.platform;
            var Browser_CookieEnabled = navigator.cookieEnabled;
            var Actual_Version,
			Actual_Name;
            var is_IE = (Browser_Name == "Microsoft Internet Explorer");
            var is_NN = (Browser_Name == "Netscape");
            var is_op = (Browser_Name == "Opera");
            if (is_NN) {
                if (Browser_Version >= 5.0) {
                    if (Browser_Agent.indexOf("Netscape") != -1) {
                        var Split_Sign = Browser_Agent.lastIndexOf("/");
                        var Version = Browser_Agent.lastIndexOf(" ");
                        var Bname = Browser_Agent.substring(0, Split_Sign);
                        var Split_sign2 = Bname.lastIndexOf(" ");
                        Actual_Version = Browser_Agent.substring(Split_Sign + 1, Browser_Agent.length);
                        Actual_Name = Bname.substring(Split_sign2 + 1, Bname.length);
                    }
                    if (Browser_Agent.indexOf("Firefox") != -1) {
                        var Split_Sign = Browser_Agent.lastIndexOf("/");
                        var Version = Browser_Agent.lastIndexOf(" ");
                        Actual_Version = Browser_Agent.substring(Split_Sign + 1, Browser_Agent.length);
                        Actual_Name = Browser_Agent.substring(Version + 1, Split_Sign);
                    }
                    if (Browser_Agent.indexOf("Safari") != -1) {
                        if (Browser_Agent.indexOf("Chrome") != -1) {
                            var Split_Sign = Browser_Agent.lastIndexOf(" ");
                            var Version = Browser_Agent.substring(0, Split_Sign); ;
                            var Split_Sign2 = Version.lastIndexOf("/");
                            var Bname = Version.lastIndexOf(" ");
                            Actual_Version = Version.substring(Split_Sign2 + 1, Version.length);
                            Actual_Name = Version.substring(Bname + 1, Split_Sign2);
                        }
                        else {
                            var Split_Sign = Browser_Agent.lastIndexOf("/");
                            var Version = Browser_Agent.substring(0, Split_Sign); ;
                            var Split_Sign2 = Version.lastIndexOf("/");
                            var Bname = Browser_Agent.lastIndexOf(" ");
                            Actual_Version = Browser_Agent.substring(Split_Sign2 + 1, Bname);
                            Actual_Name = Browser_Agent.substring(Bname + 1, Split_Sign);
                        }
                    }
                }
                else {
                    Actual_Version = Browser_Version;
                    Actual_Name = Browser_Name;
                }
            }
            else if (is_IE) {
                var Version_Start = Browser_Agent.indexOf("MSIE");
                var Version_End = Browser_Agent.indexOf(";", Version_Start);
                Actual_Version = Browser_Agent.substring(Version_Start + 5, Version_End)
                Actual_Name = Browser_Name;
                if (Browser_Agent.indexOf("Maxthon") != -1 || Browser_Agent.indexOf("MAXTHON") != -1) {
                    var mv = Browser_Agent.lastIndexOf(" ");
                    var mv1 = Browser_Agent.substring(mv, Browser_Agent.length - 1);
                    mv1 = "遨游版本:" + mv1;
                    Actual_Name += "(Maxthon)";
                    Actual_Version += mv1;
                }
            }
            else if (Browser_Agent.indexOf("Opera") != -1) {
                Actual_Name = "Opera";
                var tempstart = Browser_Agent.indexOf("Opera");
                var tempend = Browser_Agent.length;
                Actual_Version = Browser_Version;
            }
            else {
                Actual_Name = "Unknown Navigator"
                Actual_Version = "Unknown Version"
            }
            Mtopt.Request.Browser.UserAgent = Browser_Agent;
            Mtopt.Request.Browser.Name = Actual_Name;
            Mtopt.Request.Browser.Version = Actual_Version;
            Mtopt.Request.Browser.SystemLanguage = Browser_SystemLanguage;
            Mtopt.Request.Browser.UserLanguage = Browser_UserLanguage;
            Mtopt.Request.Browser.CookieEnabled = Browser_CookieEnabled;
            Mtopt.Request.Browser.Platform = Browser_Platform;
        },
        URL: function () {
            return window.document.location.href;
        },
        QueryString: function (paras) {
            var url = location.href;
            var paraString = url.substring(url.indexOf("?") + 1, url.length).split("&");
            var paraObj = {}
            for (i = 0; j = paraString[i]; i++) {
                paraObj[j.substring(0, j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=") + 1, j.length);
            }
            var returnValue = paraObj[paras.toLowerCase()];
            if (typeof (returnValue) == "undefined") {
                return null;
            } else {
                return returnValue;
            }
        },
        Browser: {
            Name: null,
            Version: null,
            UserAgent: null,
            SystemLanguage: null,
            UserLanguage: null,
            CookieEnabled: null,
            Platform: null
        },
        Post: function (url, data) {
            var data = data || "";
            var param = param;
            var httpXML = window.XMLHttpRequest ? new window.XMLHttpRequest() : new window.ActiveXObject("Microsoft.XMLHTTP");
            httpXML.open("POST", url, false);
            httpXML.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            httpXML.send(data);
            return httpXML.responseText;
        },
        Get: function (url, data) {
            var data = data || "";
            var param = param;
            var httpXML = window.XMLHttpRequest ? new window.XMLHttpRequest() : new window.ActiveXObject("Microsoft.XMLHTTP");
            httpXML.open("GET", url, false);
            httpXML.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            httpXML.send(data);
            return httpXML.responseText;
        },
        Ajax: function (varAsync, url, data, callback, param) {
            var data = data;
            var param = param;
            var httpXML = window.XMLHttpRequest ? new window.XMLHttpRequest() : new window.ActiveXObject("Microsoft.XMLHTTP");
            httpXML.onreadystatechange = function () {
                if (httpXML.readyState == 4 && httpXML.status == 200) {
                    var state = 0;
                    var data = Mtopt.CloneAll(httpXML.responseText);
                    callback(data, state, param);
                }
                delete httpXML;
            }
            httpXML.open("POST", url, varAsync);
            httpXML.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            httpXML.send(data);
        },
        Redirect: function (url) {
            if (window.location.href) {
                window.location.href = url;
            }
            else {
                window.location = url;
            }
        },
        Back: function (count) {
            window.history.go(-count);
        },
        Go: function (count) {
            window.history.go(count);
        },
        SetHomePage: function (url, obj) {
            try {
                obj.style.behavior = 'url(#default#homepage)';
                obj.setHomePage(url);
            }
            catch (e) {
                if (window.netscape) {
                    try {
                        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                    }
                    catch (e) {
                        alert("此操作被浏览器拒绝,请手动设置为主页.");
                    }
                    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
                    prefs.setCharPref('browser.startup.homepage', url);
                }
                else {
                    alert("操作失败,请手动设置为主页.");
                }
            }
        },
        SetFavorite: function (name, url) {
            try {
                window.external.addFavorite(url, name);
            }
            catch (e) {
                try {
                    window.sidebar.addPanel(name, url, "");
                }
                catch (e) {
                    alert("加入收藏失败，请使用Ctrl+D进行添加");
                }
            }
        },
        SaveAs: function () {
            if (document.execCommand) {
                document.execCommand("SaveAs");
            }
        },
        Reload: function () {
            window.location.reload();
        },
        Close: function () {
            window.close();
        }
    },
    Random: {
        String: {
            FromDefine: function (strArray, length) {
                var StrArray = strArray;
                var RetString = "";
                var Length = length;
                var RD = new Mtopt.Random.Number();
                for (var I = 0; I < Length; I++) {
                    RetString += StrArray[RD.Next(StrArray.length - 1, 0)];
                }
                return RetString;
            },
            Number: function (length) {
                var StrArray = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
                var Length = length;
                return this.FromDefine(StrArray, Length);
            },
            CapitalAlphabet: function (length) {
                var StrArray = ["A", "B", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
                var Length = length;
                return this.FromDefine(StrArray, Length);
            },
            LetterAlphabet: function (length) {
                var StrArray = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
                var Length = length;
                return this.FromDefine(StrArray, Length);
            },
            Alphabet: function (length) {
                var StrArray = ["A", "B", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
                var Length = length;
                return this.FromDefine(StrArray, Length);
            },
            AlphabetAndNumber: function (length) {
                var StrArray = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
                var Length = length;
                return this.FromDefine(StrArray, Length);
            }
        },
        Number: {
            Next: function (maxValue) {
                return Mtopt.Convert.ToInteger(window.Math.random() * maxValue + 1);
            },
            Next: function (maxValue, minValue) {
                return Mtopt.Convert.ToInteger(window.Math.random() * (maxValue - minValue + 1) + minValue);
            },
            NextDouble: function (maxValue) {
                return Mtopt.Convert.ToFloat(window.Math.random() * maxValue + 1);
            },
            NextDouble: function (maxValue, minValue) {
                return Mtopt.Convert.ToFloat(window.Math.random() * (maxValue - minValue + 1) + minValue);
            }
        },
        Color: function () {
            var arrHex = ["0", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d"],
			strHex = "#",
			index;
            for (var i = 0; i < 6; i++) {
                index = Math.round(Math.random() * 15);
                strHex += arrHex[index];
            }
            return strHex;
        }
    },
    RegExp: function (data) {
        var obj = data;
        var rep = new Object();
        rep.Match = function (repstr) {
            var Filter = repstr;
            if (Filter.test(obj) == true) {
                return true;
            }
            else {
                return false;
            }
        }
        rep.IsIpAddress = function () {
            return this.Match(/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/);
        }
        rep.IsEmail = function () {
            return this.Match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/);
        }
        rep.IsAlphabet = function () {
            return this.Match(/^[A-Za-z]+$/);
        }
        rep.IsNumber = function () {
            return this.Match(/^[0-9]*$/);
        }
        rep.IsCNWord = function () {
            return this.Match(/^[\u4e00-\u9fa5]{0,}$/);
        }
        rep.IsNoZeroBeginNumber = function () {
            return this.Match(/^(0|[1-9][0-9]*)$/);
        }
        rep.IsAlphabetAndNum = function () {
            return this.Match(/^[A-Za-z0-9]+$/);
        }
        rep.IsAlphabetAndNumAndBomLine = function () {
            return this.Match(/^\w+$/);
        }
        rep.IsCapitalAlphabet = function () {
            return this.Match(/^[A-Z]+$/);
        }
        rep.IsLetterAlphabet = function () {
            return this.Match(/^[a-z]+$/);
        }
        rep.IsPhone = function () {
            return this.Match(/^((d{3,4})|d{3,4}-)?d{7,8}$/);
        }
        rep.IsDate = function () {
            return this.Match(/^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$/);
        }
        rep.IsIDCard = function () {
            return this.Match(/^\d{15}|\d{18}$/);
        }
        rep.IsFloat = function () {
            return this.Match(/^(-?\d+)(\.\d+)?$/);
        }
        return rep;
    },
    Media: {
        Sound: function (element, url) {
            this.ElementId = element;
            this.ElementDiv = document.getElementById(element);
            this.SoundLocation = url;
            this.Play = function () {
                this.ElementDiv.innerHTML = '<embed src="' + this.SoundLocation + '" loop="1" autostart="true" hidden="true"></embed>';
            }
            this.PlayLooping = function () {
                this.ElementDiv.innerHTML = '<embed src="' + this.SoundLocation + '" loop="true" autostart="true" hidden="true"></embed>';
            }
            this.Stop = function () {
                this.ElementDiv.innerHTML = '<embed src="' + this.SoundLocation + '" loop="false" autostart="false" hidden="true"></embed>';
            }
        }
    },
    Encrypt: {
        HashCode: function (str) {
            var hash = 0;
            if (str.length == 0) return hash;
            for (i = 0; i < str.length; i++) {
                char = str.charCodeAt(i);
                hash = ((hash << 5) - hash) + char;
                hash = hash & hash;
            }
            return hash;
        },
        MD5: function (data) {
            this.sAscii = " !\"#$%&’()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
            this.sHex = "0123456789ABCDEF";
            this.hex = function (i) {
                h = "";
                for (j = 0; j <= 3; j++) {
                    h += this.sHex.charAt((i >> (j * 8 + 4)) & 0x0F) +
					this.sHex.charAt((i >> (j * 8)) & 0x0F);
                }
                return h;
            }
            this.add = function (x, y) {
                return ((x & 0x7FFFFFFF) + (y & 0x7FFFFFFF)) ^ (x & 0x80000000) ^ (y & 0x80000000);
            }
            this.R1 = function (A, B, C, D, X, S, T) {
                q = this.add(this.add(A, (B & C) | (~B & D)), this.add(X, T));
                return this.add((q << S) | ((q >> (32 - S)) & (Math.pow(2, S) - 1)), B);
            }
            this.R2 = function (A, B, C, D, X, S, T) {
                q = this.add(this.add(A, (B & D) | (C & ~D)), this.add(X, T));
                return this.add((q << S) | ((q >> (32 - S)) & (Math.pow(2, S) - 1)), B);
            }
            this.R3 = function (A, B, C, D, X, S, T) {
                q = this.add(this.add(A, B ^ C ^ D), this.add(X, T));
                return this.add((q << S) | ((q >> (32 - S)) & (Math.pow(2, S) - 1)), B);
            }
            this.R4 = function (A, B, C, D, X, S, T) {
                q = this.add(this.add(A, C ^ (B | ~D)), this.add(X, T));
                return this.add((q << S) | ((q >> (32 - S)) & (Math.pow(2, S) - 1)), B);
            }
            this.calcMD5 = function (sInp) {
                wLen = (((sInp.length + 8) >> 6) + 1) << 4;
                var X = new Array(wLen);
                j = 4;
                for (i = 0; (i * 4) < sInp.length; i++) {
                    X[i] = 0;
                    for (j = 0; (j < 4) && ((j + i * 4) < sInp.length); j++) {
                        X[i] += (this.sAscii.indexOf(sInp.charAt((i * 4) + j)) + 32) << (j * 8);
                    }
                }
                if (j == 4) {
                    X[i++] = 0x80;
                }
                else {
                    X[i - 1] += 0x80 << (j * 8);
                }
                for (; i < wLen; i++) {
                    X[i] = 0;
                }
                X[wLen - 2] = sInp.length * 8;
                a = 0x67452301;
                b = 0xefcdab89;
                c = 0x98badcfe;
                d = 0x10325476;
                for (i = 0; i < wLen; i += 16) {
                    aO = a;
                    bO = b;
                    cO = c;
                    dO = d;
                    a = this.R1(a, b, c, d, X[i + 0], 7, 0xd76aa478);
                    d = this.R1(d, a, b, c, X[i + 1], 12, 0xe8c7b756);
                    c = this.R1(c, d, a, b, X[i + 2], 17, 0x242070db);
                    b = this.R1(b, c, d, a, X[i + 3], 22, 0xc1bdceee);
                    a = this.R1(a, b, c, d, X[i + 4], 7, 0xf57c0faf);
                    d = this.R1(d, a, b, c, X[i + 5], 12, 0x4787c62a);
                    c = this.R1(c, d, a, b, X[i + 6], 17, 0xa8304613);
                    b = this.R1(b, c, d, a, X[i + 7], 22, 0xfd469501);
                    a = this.R1(a, b, c, d, X[i + 8], 7, 0x698098d8);
                    d = this.R1(d, a, b, c, X[i + 9], 12, 0x8b44f7af);
                    c = this.R1(c, d, a, b, X[i + 10], 17, 0xffff5bb1);
                    b = this.R1(b, c, d, a, X[i + 11], 22, 0x895cd7be);
                    a = this.R1(a, b, c, d, X[i + 12], 7, 0x6b901122);
                    d = this.R1(d, a, b, c, X[i + 13], 12, 0xfd987193);
                    c = this.R1(c, d, a, b, X[i + 14], 17, 0xa679438e);
                    b = this.R1(b, c, d, a, X[i + 15], 22, 0x49b40821);
                    a = this.R2(a, b, c, d, X[i + 1], 5, 0xf61e2562);
                    d = this.R2(d, a, b, c, X[i + 6], 9, 0xc040b340);
                    c = this.R2(c, d, a, b, X[i + 11], 14, 0x265e5a51);
                    b = this.R2(b, c, d, a, X[i + 0], 20, 0xe9b6c7aa);
                    a = this.R2(a, b, c, d, X[i + 5], 5, 0xd62f105d);
                    d = this.R2(d, a, b, c, X[i + 10], 9, 0x2441453);
                    c = this.R2(c, d, a, b, X[i + 15], 14, 0xd8a1e681);
                    b = this.R2(b, c, d, a, X[i + 4], 20, 0xe7d3fbc8);
                    a = this.R2(a, b, c, d, X[i + 9], 5, 0x21e1cde6);
                    d = this.R2(d, a, b, c, X[i + 14], 9, 0xc33707d6);
                    c = this.R2(c, d, a, b, X[i + 3], 14, 0xf4d50d87);
                    b = this.R2(b, c, d, a, X[i + 8], 20, 0x455a14ed);
                    a = this.R2(a, b, c, d, X[i + 13], 5, 0xa9e3e905);
                    d = this.R2(d, a, b, c, X[i + 2], 9, 0xfcefa3f8);
                    c = this.R2(c, d, a, b, X[i + 7], 14, 0x676f02d9);
                    b = this.R2(b, c, d, a, X[i + 12], 20, 0x8d2a4c8a);
                    a = this.R3(a, b, c, d, X[i + 5], 4, 0xfffa3942);
                    d = this.R3(d, a, b, c, X[i + 8], 11, 0x8771f681);
                    c = this.R3(c, d, a, b, X[i + 11], 16, 0x6d9d6122);
                    b = this.R3(b, c, d, a, X[i + 14], 23, 0xfde5380c);
                    a = this.R3(a, b, c, d, X[i + 1], 4, 0xa4beea44);
                    d = this.R3(d, a, b, c, X[i + 4], 11, 0x4bdecfa9);
                    c = this.R3(c, d, a, b, X[i + 7], 16, 0xf6bb4b60);
                    b = this.R3(b, c, d, a, X[i + 10], 23, 0xbebfbc70);
                    a = this.R3(a, b, c, d, X[i + 13], 4, 0x289b7ec6);
                    d = this.R3(d, a, b, c, X[i + 0], 11, 0xeaa127fa);
                    c = this.R3(c, d, a, b, X[i + 3], 16, 0xd4ef3085);
                    b = this.R3(b, c, d, a, X[i + 6], 23, 0x4881d05);
                    a = this.R3(a, b, c, d, X[i + 9], 4, 0xd9d4d039);
                    d = this.R3(d, a, b, c, X[i + 12], 11, 0xe6db99e5);
                    c = this.R3(c, d, a, b, X[i + 15], 16, 0x1fa27cf8);
                    b = this.R3(b, c, d, a, X[i + 2], 23, 0xc4ac5665);
                    a = this.R4(a, b, c, d, X[i + 0], 6, 0xf4292244);
                    d = this.R4(d, a, b, c, X[i + 7], 10, 0x432aff97);
                    c = this.R4(c, d, a, b, X[i + 14], 15, 0xab9423a7);
                    b = this.R4(b, c, d, a, X[i + 5], 21, 0xfc93a039);
                    a = this.R4(a, b, c, d, X[i + 12], 6, 0x655b59c3);
                    d = this.R4(d, a, b, c, X[i + 3], 10, 0x8f0ccc92);
                    c = this.R4(c, d, a, b, X[i + 10], 15, 0xffeff47d);
                    b = this.R4(b, c, d, a, X[i + 1], 21, 0x85845dd1);
                    a = this.R4(a, b, c, d, X[i + 8], 6, 0x6fa87e4f);
                    d = this.R4(d, a, b, c, X[i + 15], 10, 0xfe2ce6e0);
                    c = this.R4(c, d, a, b, X[i + 6], 15, 0xa3014314);
                    b = this.R4(b, c, d, a, X[i + 13], 21, 0x4e0811a1);
                    a = this.R4(a, b, c, d, X[i + 4], 6, 0xf7537e82);
                    d = this.R4(d, a, b, c, X[i + 11], 10, 0xbd3af235);
                    c = this.R4(c, d, a, b, X[i + 2], 15, 0x2ad7d2bb);
                    b = this.R4(b, c, d, a, X[i + 9], 21, 0xeb86d391);
                    a = this.add(a, aO);
                    b = this.add(b, bO);
                    c = this.add(c, cO);
                    d = this.add(d, dO);
                }
                return this.hex(a) + this.hex(b) + this.hex(c) + this.hex(d);
            }
            return this.calcMD5(data);
        },
        Base64Encode: function (str) {
            var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
            var base64DecodeChars = new Array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
            var out,
			i,
			len;
            var c1,
			c2,
			c3;
            len = str.length;
            i = 0;
            out = "";
            while (i < len) {
                c1 = str.charCodeAt(i++) & 0xff;
                if (i == len) {
                    out += base64EncodeChars.charAt(c1 >> 2);
                    out += base64EncodeChars.charAt((c1 & 0x3) << 4);
                    out += "==";
                    break;
                }
                c2 = str.charCodeAt(i++);
                if (i == len) {
                    out += base64EncodeChars.charAt(c1 >> 2);
                    out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
                    out += base64EncodeChars.charAt((c2 & 0xF) << 2);
                    out += "=";
                    break;
                }
                c3 = str.charCodeAt(i++);
                out += base64EncodeChars.charAt(c1 >> 2);
                out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
                out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
                out += base64EncodeChars.charAt(c3 & 0x3F);
            }
            return out;
        },
        Base64Decode: function (str) {
            var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
            var base64DecodeChars = new Array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
            var c1,
			c2,
			c3,
			c4;
            var i,
			len,
			out;
            len = str.length;
            i = 0;
            out = "";
            while (i < len) {
                do {
                    c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
                }
                while (i < len && c1 == -1);
                if (c1 == -1)
                    break;
                do {
                    c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
                }
                while (i < len && c2 == -1);
                if (c2 == -1)
                    break;
                out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
                do {
                    c3 = str.charCodeAt(i++) & 0xff;
                    if (c3 == 61)
                        return out;
                    c3 = base64DecodeChars[c3];
                }
                while (i < len && c3 == -1);
                if (c3 == -1)
                    break;
                out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));
                do {
                    c4 = str.charCodeAt(i++) & 0xff;
                    if (c4 == 61)
                        return out;
                    c4 = base64DecodeChars[c4];
                }
                while (i < len && c4 == -1);
                if (c4 == -1)
                    break;
                out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
            }
            return out;
        },
        DESEncode: function (data, key) {
            var Encode = this.DES(key, data, 1, 0);
            var r = "";
            var hexes = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
            for (var i = 0; i < (Encode.length); i++) {
                r += hexes[Encode.charCodeAt(i) >> 4] + hexes[Encode.charCodeAt(i) & 0xf];
            }
            return r;
        },
        DESDecode: function (data, key) {
            var r = "";
            for (var i = 0; i < data.length; i += 2) {
                var sxx = parseInt(data.substring(i, i + 2), 16);
                r += String.fromCharCode(sxx);
            }
            return this.DES(key, r, 0, 0);
        },
        DES: function (key, message, encrypt, mode, iv) {
            var spfunction1 = new Array(0x1010400, 0, 0x10000, 0x1010404, 0x1010004, 0x10404, 0x4, 0x10000, 0x400, 0x1010400, 0x1010404, 0x400, 0x1000404, 0x1010004, 0x1000000, 0x4, 0x404, 0x1000400, 0x1000400, 0x10400, 0x10400, 0x1010000, 0x1010000, 0x1000404, 0x10004, 0x1000004, 0x1000004, 0x10004, 0, 0x404, 0x10404, 0x1000000, 0x10000, 0x1010404, 0x4, 0x1010000, 0x1010400, 0x1000000, 0x1000000, 0x400, 0x1010004, 0x10000, 0x10400, 0x1000004, 0x400, 0x4, 0x1000404, 0x10404, 0x1010404, 0x10004, 0x1010000, 0x1000404, 0x1000004, 0x404, 0x10404, 0x1010400, 0x404, 0x1000400, 0x1000400, 0, 0x10004, 0x10400, 0, 0x1010004);
            var spfunction2 = new Array(-0x7fef7fe0, -0x7fff8000, 0x8000, 0x108020, 0x100000, 0x20, -0x7fefffe0, -0x7fff7fe0, -0x7fffffe0, -0x7fef7fe0, -0x7fef8000, -0x80000000, -0x7fff8000, 0x100000, 0x20, -0x7fefffe0, 0x108000, 0x100020, -0x7fff7fe0, 0, -0x80000000, 0x8000, 0x108020, -0x7ff00000, 0x100020, -0x7fffffe0, 0, 0x108000, 0x8020, -0x7fef8000, -0x7ff00000, 0x8020, 0, 0x108020, -0x7fefffe0, 0x100000, -0x7fff7fe0, -0x7ff00000, -0x7fef8000, 0x8000, -0x7ff00000, -0x7fff8000, 0x20, -0x7fef7fe0, 0x108020, 0x20, 0x8000, -0x80000000, 0x8020, -0x7fef8000, 0x100000, -0x7fffffe0, 0x100020, -0x7fff7fe0, -0x7fffffe0, 0x100020, 0x108000, 0, -0x7fff8000, 0x8020, -0x80000000, -0x7fefffe0, -0x7fef7fe0, 0x108000);
            var spfunction3 = new Array(0x208, 0x8020200, 0, 0x8020008, 0x8000200, 0, 0x20208, 0x8000200, 0x20008, 0x8000008, 0x8000008, 0x20000, 0x8020208, 0x20008, 0x8020000, 0x208, 0x8000000, 0x8, 0x8020200, 0x200, 0x20200, 0x8020000, 0x8020008, 0x20208, 0x8000208, 0x20200, 0x20000, 0x8000208, 0x8, 0x8020208, 0x200, 0x8000000, 0x8020200, 0x8000000, 0x20008, 0x208, 0x20000, 0x8020200, 0x8000200, 0, 0x200, 0x20008, 0x8020208, 0x8000200, 0x8000008, 0x200, 0, 0x8020008, 0x8000208, 0x20000, 0x8000000, 0x8020208, 0x8, 0x20208, 0x20200, 0x8000008, 0x8020000, 0x8000208, 0x208, 0x8020000, 0x20208, 0x8, 0x8020008, 0x20200);
            var spfunction4 = new Array(0x802001, 0x2081, 0x2081, 0x80, 0x802080, 0x800081, 0x800001, 0x2001, 0, 0x802000, 0x802000, 0x802081, 0x81, 0, 0x800080, 0x800001, 0x1, 0x2000, 0x800000, 0x802001, 0x80, 0x800000, 0x2001, 0x2080, 0x800081, 0x1, 0x2080, 0x800080, 0x2000, 0x802080, 0x802081, 0x81, 0x800080, 0x800001, 0x802000, 0x802081, 0x81, 0, 0, 0x802000, 0x2080, 0x800080, 0x800081, 0x1, 0x802001, 0x2081, 0x2081, 0x80, 0x802081, 0x81, 0x1, 0x2000, 0x800001, 0x2001, 0x802080, 0x800081, 0x2001, 0x2080, 0x800000, 0x802001, 0x80, 0x800000, 0x2000, 0x802080);
            var spfunction5 = new Array(0x100, 0x2080100, 0x2080000, 0x42000100, 0x80000, 0x100, 0x40000000, 0x2080000, 0x40080100, 0x80000, 0x2000100, 0x40080100, 0x42000100, 0x42080000, 0x80100, 0x40000000, 0x2000000, 0x40080000, 0x40080000, 0, 0x40000100, 0x42080100, 0x42080100, 0x2000100, 0x42080000, 0x40000100, 0, 0x42000000, 0x2080100, 0x2000000, 0x42000000, 0x80100, 0x80000, 0x42000100, 0x100, 0x2000000, 0x40000000, 0x2080000, 0x42000100, 0x40080100, 0x2000100, 0x40000000, 0x42080000, 0x2080100, 0x40080100, 0x100, 0x2000000, 0x42080000, 0x42080100, 0x80100, 0x42000000, 0x42080100, 0x2080000, 0, 0x40080000, 0x42000000, 0x80100, 0x2000100, 0x40000100, 0x80000, 0, 0x40080000, 0x2080100, 0x40000100);
            var spfunction6 = new Array(0x20000010, 0x20400000, 0x4000, 0x20404010, 0x20400000, 0x10, 0x20404010, 0x400000, 0x20004000, 0x404010, 0x400000, 0x20000010, 0x400010, 0x20004000, 0x20000000, 0x4010, 0, 0x400010, 0x20004010, 0x4000, 0x404000, 0x20004010, 0x10, 0x20400010, 0x20400010, 0, 0x404010, 0x20404000, 0x4010, 0x404000, 0x20404000, 0x20000000, 0x20004000, 0x10, 0x20400010, 0x404000, 0x20404010, 0x400000, 0x4010, 0x20000010, 0x400000, 0x20004000, 0x20000000, 0x4010, 0x20000010, 0x20404010, 0x404000, 0x20400000, 0x404010, 0x20404000, 0, 0x20400010, 0x10, 0x4000, 0x20400000, 0x404010, 0x4000, 0x400010, 0x20004010, 0, 0x20404000, 0x20000000, 0x400010, 0x20004010);
            var spfunction7 = new Array(0x200000, 0x4200002, 0x4000802, 0, 0x800, 0x4000802, 0x200802, 0x4200800, 0x4200802, 0x200000, 0, 0x4000002, 0x2, 0x4000000, 0x4200002, 0x802, 0x4000800, 0x200802, 0x200002, 0x4000800, 0x4000002, 0x4200000, 0x4200800, 0x200002, 0x4200000, 0x800, 0x802, 0x4200802, 0x200800, 0x2, 0x4000000, 0x200800, 0x4000000, 0x200800, 0x200000, 0x4000802, 0x4000802, 0x4200002, 0x4200002, 0x2, 0x200002, 0x4000000, 0x4000800, 0x200000, 0x4200800, 0x802, 0x200802, 0x4200800, 0x802, 0x4000002, 0x4200802, 0x4200000, 0x200800, 0, 0x2, 0x4200802, 0, 0x200802, 0x4200000, 0x800, 0x4000002, 0x4000800, 0x800, 0x200002);
            var spfunction8 = new Array(0x10001040, 0x1000, 0x40000, 0x10041040, 0x10000000, 0x10001040, 0x40, 0x10000000, 0x40040, 0x10040000, 0x10041040, 0x41000, 0x10041000, 0x41040, 0x1000, 0x40, 0x10040000, 0x10000040, 0x10001000, 0x1040, 0x41000, 0x40040, 0x10040040, 0x10041000, 0x1040, 0, 0, 0x10040040, 0x10000040, 0x10001000, 0x41040, 0x40000, 0x41040, 0x40000, 0x10041000, 0x1000, 0x40, 0x10040040, 0x1000, 0x41040, 0x10001000, 0x40, 0x10000040, 0x10040000, 0x10040040, 0x10000000, 0x40000, 0x10001040, 0, 0x10041040, 0x40040, 0x10000040, 0x10040000, 0x10001000, 0x10001040, 0, 0x10041040, 0x41000, 0x41000, 0x1040, 0x1040, 0x40040, 0x10000000, 0x10041000);
            var keys = this.DESCreateKey(key);
            var m = 0,
			i,
			j,
			temp,
			temp2,
			right1,
			right2,
			left,
			right,
			looping;
            var cbcleft,
			cbcleft2,
			cbcright,
			cbcright2
            var endloop,
			loopinc;
            var len = message.length;
            var chunk = 0;
            var iterations = keys.length == 32 ? 3 : 9;
            if (iterations == 3) {
                looping = encrypt ? new Array(0, 32, 2) : new Array(30, -2, -2);
            }
            else {
                looping = encrypt ? new Array(0, 32, 2, 62, 30, -2, 64, 96, 2) : new Array(94, 62, -2, 32, 64, 2, 30, -2, -2);
            }
            message += "\0\0\0\0\0\0\0\0";
            result = "";
            tempresult = "";
            if (mode == 1) {
                cbcleft = (iv.charCodeAt(m++) << 24) | (iv.charCodeAt(m++) << 16) | (iv.charCodeAt(m++) << 8) | iv.charCodeAt(m++);
                cbcright = (iv.charCodeAt(m++) << 24) | (iv.charCodeAt(m++) << 16) | (iv.charCodeAt(m++) << 8) | iv.charCodeAt(m++);
                m = 0;
            }
            while (m < len) {
                if (encrypt) {
                    left = (message.charCodeAt(m++) << 16) | message.charCodeAt(m++);
                    right = (message.charCodeAt(m++) << 16) | message.charCodeAt(m++);
                } else {
                    left = (message.charCodeAt(m++) << 24) | (message.charCodeAt(m++) << 16) | (message.charCodeAt(m++) << 8) | message.charCodeAt(m++);
                    right = (message.charCodeAt(m++) << 24) | (message.charCodeAt(m++) << 16) | (message.charCodeAt(m++) << 8) | message.charCodeAt(m++);
                }
                if (mode == 1) {
                    if (encrypt) {
                        left ^= cbcleft;
                        right ^= cbcright;
                    } else {
                        cbcleft2 = cbcleft;
                        cbcright2 = cbcright;
                        cbcleft = left;
                        cbcright = right;
                    }
                }
                temp = ((left >>> 4) ^ right) & 0x0f0f0f0f;
                right ^= temp;
                left ^= (temp << 4);
                temp = ((left >>> 16) ^ right) & 0x0000ffff;
                right ^= temp;
                left ^= (temp << 16);
                temp = ((right >>> 2) ^ left) & 0x33333333;
                left ^= temp;
                right ^= (temp << 2);
                temp = ((right >>> 8) ^ left) & 0x00ff00ff;
                left ^= temp;
                right ^= (temp << 8);
                temp = ((left >>> 1) ^ right) & 0x55555555;
                right ^= temp;
                left ^= (temp << 1);
                left = ((left << 1) | (left >>> 31));
                right = ((right << 1) | (right >>> 31));
                for (j = 0; j < iterations; j += 3) {
                    endloop = looping[j + 1];
                    loopinc = looping[j + 2];
                    for (i = looping[j]; i != endloop; i += loopinc) {
                        right1 = right ^ keys[i];
                        right2 = ((right >>> 4) | (right << 28)) ^ keys[i + 1];
                        temp = left;
                        left = right;
                        right = temp ^ (spfunction2[(right1 >>> 24) & 0x3f] | spfunction4[(right1 >>> 16) & 0x3f] | spfunction6[(right1 >>> 8) & 0x3f] | spfunction8[right1 & 0x3f] | spfunction1[(right2 >>> 24) & 0x3f] | spfunction3[(right2 >>> 16) & 0x3f] | spfunction5[(right2 >>> 8) & 0x3f] | spfunction7[right2 & 0x3f]);
                    }
                    temp = left;
                    left = right;
                    right = temp;
                }
                left = ((left >>> 1) | (left << 31));
                right = ((right >>> 1) | (right << 31));
                temp = ((left >>> 1) ^ right) & 0x55555555;
                right ^= temp;
                left ^= (temp << 1);
                temp = ((right >>> 8) ^ left) & 0x00ff00ff;
                left ^= temp;
                right ^= (temp << 8);
                temp = ((right >>> 2) ^ left) & 0x33333333;
                left ^= temp;
                right ^= (temp << 2);
                temp = ((left >>> 16) ^ right) & 0x0000ffff;
                right ^= temp;
                left ^= (temp << 16);
                temp = ((left >>> 4) ^ right) & 0x0f0f0f0f;
                right ^= temp;
                left ^= (temp << 4);
                if (mode == 1) {
                    if (encrypt) {
                        cbcleft = left;
                        cbcright = right;
                    } else {
                        left ^= cbcleft2;
                        right ^= cbcright2;
                    }
                }
                if (encrypt) {
                    tempresult += String.fromCharCode((left >>> 24), ((left >>> 16) & 0xff), ((left >>> 8) & 0xff), (left & 0xff), (right >>> 24), ((right >>> 16) & 0xff), ((right >>> 8) & 0xff), (right & 0xff));
                }
                else {
                    tempresult += String.fromCharCode(((left >>> 16) & 0xffff), (left & 0xffff), ((right >>> 16) & 0xffff), (right & 0xffff));
                }
                encrypt ? chunk += 16 : chunk += 8;
                if (chunk == 512) {
                    result += tempresult;
                    tempresult = "";
                    chunk = 0;
                }
            }
            return result + tempresult;
        },
        DESCreateKey: function (key) {
            pc2bytes0 = new Array(0, 0x4, 0x20000000, 0x20000004, 0x10000, 0x10004, 0x20010000, 0x20010004, 0x200, 0x204, 0x20000200, 0x20000204, 0x10200, 0x10204, 0x20010200, 0x20010204);
            pc2bytes1 = new Array(0, 0x1, 0x100000, 0x100001, 0x4000000, 0x4000001, 0x4100000, 0x4100001, 0x100, 0x101, 0x100100, 0x100101, 0x4000100, 0x4000101, 0x4100100, 0x4100101);
            pc2bytes2 = new Array(0, 0x8, 0x800, 0x808, 0x1000000, 0x1000008, 0x1000800, 0x1000808, 0, 0x8, 0x800, 0x808, 0x1000000, 0x1000008, 0x1000800, 0x1000808);
            pc2bytes3 = new Array(0, 0x200000, 0x8000000, 0x8200000, 0x2000, 0x202000, 0x8002000, 0x8202000, 0x20000, 0x220000, 0x8020000, 0x8220000, 0x22000, 0x222000, 0x8022000, 0x8222000);
            pc2bytes4 = new Array(0, 0x40000, 0x10, 0x40010, 0, 0x40000, 0x10, 0x40010, 0x1000, 0x41000, 0x1010, 0x41010, 0x1000, 0x41000, 0x1010, 0x41010);
            pc2bytes5 = new Array(0, 0x400, 0x20, 0x420, 0, 0x400, 0x20, 0x420, 0x2000000, 0x2000400, 0x2000020, 0x2000420, 0x2000000, 0x2000400, 0x2000020, 0x2000420);
            pc2bytes6 = new Array(0, 0x10000000, 0x80000, 0x10080000, 0x2, 0x10000002, 0x80002, 0x10080002, 0, 0x10000000, 0x80000, 0x10080000, 0x2, 0x10000002, 0x80002, 0x10080002);
            pc2bytes7 = new Array(0, 0x10000, 0x800, 0x10800, 0x20000000, 0x20010000, 0x20000800, 0x20010800, 0x20000, 0x30000, 0x20800, 0x30800, 0x20020000, 0x20030000, 0x20020800, 0x20030800);
            pc2bytes8 = new Array(0, 0x40000, 0, 0x40000, 0x2, 0x40002, 0x2, 0x40002, 0x2000000, 0x2040000, 0x2000000, 0x2040000, 0x2000002, 0x2040002, 0x2000002, 0x2040002);
            pc2bytes9 = new Array(0, 0x10000000, 0x8, 0x10000008, 0, 0x10000000, 0x8, 0x10000008, 0x400, 0x10000400, 0x408, 0x10000408, 0x400, 0x10000400, 0x408, 0x10000408);
            pc2bytes10 = new Array(0, 0x20, 0, 0x20, 0x100000, 0x100020, 0x100000, 0x100020, 0x2000, 0x2020, 0x2000, 0x2020, 0x102000, 0x102020, 0x102000, 0x102020);
            pc2bytes11 = new Array(0, 0x1000000, 0x200, 0x1000200, 0x200000, 0x1200000, 0x200200, 0x1200200, 0x4000000, 0x5000000, 0x4000200, 0x5000200, 0x4200000, 0x5200000, 0x4200200, 0x5200200);
            pc2bytes12 = new Array(0, 0x1000, 0x8000000, 0x8001000, 0x80000, 0x81000, 0x8080000, 0x8081000, 0x10, 0x1010, 0x8000010, 0x8001010, 0x80010, 0x81010, 0x8080010, 0x8081010);
            pc2bytes13 = new Array(0, 0x4, 0x100, 0x104, 0, 0x4, 0x100, 0x104, 0x1, 0x5, 0x101, 0x105, 0x1, 0x5, 0x101, 0x105);
            var iterations = key.length >= 24 ? 3 : 1;
            var keys = new Array(32 * iterations);
            var shifts = new Array(0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0);
            var lefttemp,
			righttemp,
			m = 0,
			n = 0,
			temp;
            for (var j = 0; j < iterations; j++) {
                left = (key.charCodeAt(m++) << 24) | (key.charCodeAt(m++) << 16) | (key.charCodeAt(m++) << 8) | key.charCodeAt(m++);
                right = (key.charCodeAt(m++) << 24) | (key.charCodeAt(m++) << 16) | (key.charCodeAt(m++) << 8) | key.charCodeAt(m++);
                temp = ((left >>> 4) ^ right) & 0x0f0f0f0f;
                right ^= temp;
                left ^= (temp << 4);
                temp = ((right >>> -16) ^ left) & 0x0000ffff;
                left ^= temp;
                right ^= (temp << -16);
                temp = ((left >>> 2) ^ right) & 0x33333333;
                right ^= temp;
                left ^= (temp << 2);
                temp = ((right >>> -16) ^ left) & 0x0000ffff;
                left ^= temp;
                right ^= (temp << -16);
                temp = ((left >>> 1) ^ right) & 0x55555555;
                right ^= temp;
                left ^= (temp << 1);
                temp = ((right >>> 8) ^ left) & 0x00ff00ff;
                left ^= temp;
                right ^= (temp << 8);
                temp = ((left >>> 1) ^ right) & 0x55555555;
                right ^= temp;
                left ^= (temp << 1);
                temp = (left << 8) | ((right >>> 20) & 0x000000f0);
                left = (right << 24) | ((right << 8) & 0xff0000) | ((right >>> 8) & 0xff00) | ((right >>> 24) & 0xf0);
                right = temp;
                for (i = 0; i < shifts.length; i++) {
                    if (shifts[i]) {
                        left = (left << 2) | (left >>> 26);
                        right = (right << 2) | (right >>> 26);
                    }
                    else {
                        left = (left << 1) | (left >>> 27);
                        right = (right << 1) | (right >>> 27);
                    }
                    left &= -0xf;
                    right &= -0xf;
                    lefttemp = pc2bytes0[left >>> 28] | pc2bytes1[(left >>> 24) & 0xf] | pc2bytes2[(left >>> 20) & 0xf] | pc2bytes3[(left >>> 16) & 0xf] | pc2bytes4[(left >>> 12) & 0xf] | pc2bytes5[(left >>> 8) & 0xf] | pc2bytes6[(left >>> 4) & 0xf];
                    righttemp = pc2bytes7[right >>> 28] | pc2bytes8[(right >>> 24) & 0xf] | pc2bytes9[(right >>> 20) & 0xf] | pc2bytes10[(right >>> 16) & 0xf] | pc2bytes11[(right >>> 12) & 0xf] | pc2bytes12[(right >>> 8) & 0xf] | pc2bytes13[(right >>> 4) & 0xf];
                    temp = ((righttemp >>> 16) ^ lefttemp) & 0x0000ffff;
                    keys[n++] = lefttemp ^ temp;
                    keys[n++] = righttemp ^ (temp << 16);
                }
            }
            return keys;
        },
        URLEncode: function (Str) {
            if (Str == null || Str == "")
                return "";
            var newStr = "";
            function toCase(sStr) {
                return sStr.toString(16).toUpperCase();
            }
            for (var i = 0, icode, len = Str.length; i < len; i++) {
                icode = Str.charCodeAt(i);
                if (icode < 0x10)
                    newStr += "%0" + icode.toString(16).toUpperCase();
                else if (icode < 0x80) {
                    if (icode == 0x20)
                        newStr += "+";
                    else if ((icode >= 0x30 && icode <= 0x39) || (icode >= 0x41 && icode <= 0x5A) || (icode >= 0x61 && icode <= 0x7A))
                        newStr += Str.charAt(i);
                    else
                        newStr += "%" + toCase(icode);
                }
                else if (icode < 0x800) {
                    newStr += "%" + toCase(0xC0 + (icode >> 6));
                    newStr += "%" + toCase(0x80 + icode % 0x40);
                }
                else {
                    newStr += "%" + toCase(0xE0 + (icode >> 12));
                    newStr += "%" + toCase(0x80 + (icode >> 6) % 0x40);
                    newStr += "%" + toCase(0x80 + icode % 0x40);
                }
            }
            return newStr;
        },
        URLDecode: function (zipStr) {
            var uzipStr = "";
            for (var i = 0; i < zipStr.length; i++) {
                var chr = zipStr.charAt(i);
                if (chr == "+") {
                    uzipStr += " ";
                } else if (chr == "%") {
                    var asc = zipStr.substring(i + 1, i + 3);
                    if (parseInt("0x" + asc) > 0x7f) {
                        uzipStr += decodeURI("%" + asc.toString() + zipStr.substring(i + 3, i + 9).toString());
                        i += 8;
                    } else {
                        uzipStr += AsciiToString(parseInt("0x" + asc));
                        i += 2;
                    }
                } else {
                    uzipStr += chr;
                }
            }
            return uzipStr;
        },
        HTMLEncode: function (data) {
            var Str = data;
            Str = Mtopt.Data.String(Str).Replace(" ", "&nbsp;");
            Str = Mtopt.Data.String(Str).Replace("<", "&lt;");
            Str = Mtopt.Data.String(Str).Replace(">", "&gt;");
            Str = Mtopt.Data.String(Str).Replace("\"", "&quot;");
            Str = Mtopt.Data.String(Str).Replace("'", "&#39;");
            Str = Mtopt.Data.String(Str).Replace("\n", "<br>");
            return Str;
        },
        HTMLDecode: function (zipdata) {
            return Mtopt.Decode(zipdata);
        }
    },
    ADO: function (connectionString) {
        this.IsOpen = false;
        this.ConnectionObject = null;
        this.ConnectionString = connectionString;
        this.Open = function () {
            this.ConnectionObject = new ActiveXObject("ADODB.Connection");
            this.ConnectionObject.Open(this.ConnectionString);
            this.IsOpen = true;
            return this.IsOpen;
        }
        this.Close = function () {
            this.ConnectionObject.Close();
            this.ConnectionObject = null;
            this.IsOpen = false;
        }
        this.Execute = function (command) {
            var val = this.ConnectionObject.Execute(command);
            return val;
        }
        this.GetTable = function (command) {
            var val = this.ConnectionObject.Execute(command);
            var fdCount = val.Fields.Count - 1;
            if (!val.EOF) {
                return val;
            }
            else {
                return null;
            }
        }
        this.SetSqlServerConnection = function (server, database, uid, pwd) {
            this.ConnectionString = "Driver={SQL Server};SERVER=" + server + ";UID=" + uid + ";PWD=" + pwd + ";DATABASE=" + database;
        }
        this.SetAccessConnection = function (path) {
            this.ConnectionString = "driver={Microsoft Access Driver (*.mdb)};dbq=" + path;
        }
    },
    Init: function () {
        Mtopt.Event.Load.Install(function () {
            if (Mtopt.Cache.GetValue("Mtopt.IsPostBack") == null) {
                Mtopt.Cache.SetValue("Mtopt.IsPostBack", Mtopt.Encrypt.HashCode(Mtopt.Request.URL));
                Mtopt.IsPostBack = true;
            }
            else {
                var URL = Mtopt.Cache.GetValue("Mtopt.IsPostBack");
                if (Mtopt.Encrypt.HashCode(URL) == Mtopt.Encrypt.HashCode(Mtopt.Request.URL)) {
                    Mtopt.IsPostBack = false;
                }
                else {
                    Mtopt.IsPostBack = true;
                }
            }
        });
    }
}
function MtoptExec(obj, funName) {
	if (typeof(obj) != 'object')
	 return obj;
	if (obj == null)
	 return obj;
	var NewObj = new Object();
	for (var i in obj) {
		if (i == funName) {
			obj[i]();
		}
		 else {}
		NewObj[i] = MtoptExec(obj[i], funName);
	}
	return NewObj;
}
MtoptExec(Mtopt, "Init");
var $M = Mtopt;
var $MD = Mtopt.Data;
var $MCVT = Mtopt.Convert;
var $MCC = Mtopt.Cache;
var $MRT = Mtopt.Request;
var $MCK = Mtopt.Cookie;
var $MEM = Mtopt.Element;
var $MET = Mtopt.Event;
var $MJO = Mtopt.Json;
var $MREP = Mtopt.RegExp;